import django_filters
from rest_framework import filters
from django_filters.rest_framework import DjangoFilterBackend
from encourage.models import *

class EncourageDataKeguanFilter(django_filters.rest_framework.FilterSet):
    '''月月邮免单-客管推送过滤'''
    push_status = django_filters.BaseInFilter(field_name='push_status', lookup_expr='in')
    activity_id = django_filters.BaseInFilter(field_name='encouragedraw_id', lookup_expr='in')
    push_time_begin = django_filters.DateTimeFilter(field_name="push_time__date", lookup_expr='gte')
    push_time_end = django_filters.DateTimeFilter(field_name="push_time__date", lookup_expr='lte')

    class Meta:
        model = EncourageDrawDataKeguan
        fields = ('push_status', 'activity_id', 'push_time_begin', 'push_time_end')
